package com.ali.juejin.model.main

import androidx.lifecycle.MutableLiveData
import com.ali.juejin.base.BaseModelView
import com.ali.juejin.bean.CategoryListBean
import com.ali.juejin.bean.v1.category.Data
import com.ali.juejin.config.UrlConfigV1
import com.ali.juejin.services.CategoryServices
import com.ali.juejin.utils.Request

class CategoryModel: BaseModelView() {
    val categoryList by lazy { MutableLiveData<List<Data>>() }
    val net by lazy { Request.instance(UrlConfigV1.CATEGORYAPI) }

    fun getCategoryList(){
        request<CategoryListBean>({
            val data = net.create(CategoryServices::class.java).getCategoryList()
            categoryList.postValue(data.data)
        })
    }
}